﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LaughingDog.GameObjects;
using Microsoft.Xna.Framework;

namespace LaughingDog.Components.Shapes
{
    public class TriangleShape : Shape
    {
        Vector2 mVectorA;
        Vector2 mVectorB;
        Vector2 mVectorC;

        public Vector2 PointA { get { return mVectorA; } set { mVectorA = value; Create(); } }
        public Vector2 PointB { get { return mVectorB; } set { mVectorB = value; Create(); } }
        public Vector2 PointC { get { return mVectorC; } set { mVectorC = value; Create(); } }

        public TriangleShape(GameObject gameObject)
            : base(gameObject)
        {
        }

        private void Create()
        {
            ClearVectors();
            AddVector(mVectorA);
            AddVector(mVectorB);
            AddVector(mVectorC);
            AddVector(mVectorA);
        }

        public void CreateFromBounds()
        {
            // Use this for the other way up.
            //mVectorA = -Renderer.Origin;
            //mVectorB = new Vector2(mVectorA.X + Transform.ScaledSize.X, mVectorA.Y);
            //mVectorC = new Vector2(0, Transform.ScaledSize.Y / 2);

            mVectorA = -Renderer.Origin + new Vector2(0, Transform.ScaledSize.Y);
            mVectorB = new Vector2(mVectorA.X + Transform.ScaledSize.X, mVectorA.Y);
            mVectorC = -Renderer.Origin + new Vector2(Transform.ScaledSize.X / 2, 0);

            Create();
        }
    }
}
